<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/9
 * Time: 14:54
 */

namespace App\Http\Model;


class ProductModel extends CommonModel {

    protected $table      = 'product';
    protected $primaryKey = 'ProId';
    protected $fillable   = ['ProName','ProSummary','ProPrice','ProPreview',
                            'ProCateId','ProParentId','ProSort' ];


    public function __construct(array $attributes=[]) {
        parent::__construct($attributes);
    }

    public function getProductsInfoByCateId($cateId,array $fields=null) {
        return self::where('ProStatus',0)->where('ProCateId',$cateId)->get($fields);
    }

    public function getProductById($proId,array $fields=null) {
        return self::where('ProStatus',0)->where('ProId',$proId)->get($fields);

    }




}